.class public Les/o9;
.super Ljava/lang/Object;
.source "MPEG4Writer.java"

# interfaces
.implements Les/i9;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Les/o9$b;
    }
.end annotation


# instance fields
.field private final a:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List<",
            "Les/p9;",
            ">;"
        }
    .end annotation
.end field

.field private b:Z

.field private c:Z

.field private d:J

.field private e:J

.field private f:J

.field private g:Z

.field private h:J

.field private i:Les/n9;

.field private j:Z

.field private final k:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map<",
            "Ljava/lang/String;",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation
.end field

.field private l:Ljava/lang/String;

.field private m:Z

.field private n:Ljava/util/concurrent/ConcurrentLinkedQueue;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/concurrent/ConcurrentLinkedQueue<",
            "Ljava/util/List<",
            "Lcom/esfile/screen/recorder/media/util/l;",
            ">;>;"
        }
    .end annotation
.end field

.field private o:Landroid/os/HandlerThread;

.field private p:Les/o9$b;

.field private q:Les/r9;


# direct methods
.method public constructor <init>(Ljava/lang/String;)V
    .locals 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 2
    new-instance v0, Ljava/util/ArrayList;

    const/4 v1, 0x2

    invoke-direct {v0, v1}, Ljava/util/ArrayList;-><init>(I)V

    iput-object v0, p0, Les/o9;->a:Ljava/util/List;

    const/4 v0, 0x0

    .line 3
    iput-boolean v0, p0, Les/o9;->c:Z

    .line 4
    iput-boolean v0, p0, Les/o9;->j:Z

    .line 5
    new-instance v1, Ljava/util/HashMap;

    const/16 v2, 0xa

    invoke-direct {v1, v2}, Ljava/util/HashMap;-><init>(I)V

    iput-object v1, p0, Les/o9;->k:Ljava/util/Map;

    .line 6
    iput-boolean v0, p0, Les/o9;->m:Z

    .line 7
    new-instance v1, Ljava/util/concurrent/ConcurrentLinkedQueue;

    invoke-direct {v1}, Ljava/util/concurrent/ConcurrentLinkedQueue;-><init>()V

    iput-object v1, p0, Les/o9;->n:Ljava/util/concurrent/ConcurrentLinkedQueue;

    .line 8
    iput-object p1, p0, Les/o9;->l:Ljava/lang/String;

    .line 9
    new-instance v1, Les/n9;

    const-string v2, "rw"

    invoke-direct {v1, p1, v2}, Les/n9;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    iput-object v1, p0, Les/o9;->i:Les/n9;

    const/4 p1, 0x1

    .line 10
    iput-boolean p1, p0, Les/o9;->c:Z

    .line 11
    iput-boolean v0, p0, Les/o9;->b:Z

    const-wide/16 v0, 0x0

    .line 12
    iput-wide v0, p0, Les/o9;->f:J

    .line 13
    iput-wide v0, p0, Les/o9;->d:J

    .line 14
    iput-wide v0, p0, Les/o9;->e:J

    .line 15
    iput-boolean p1, p0, Les/o9;->g:Z

    .line 16
    invoke-direct {p0}, Les/o9;->d()V

    return-void
.end method

.method static synthetic a(Les/o9;)Ljava/util/concurrent/ConcurrentLinkedQueue;
    .locals 0

    .line 3
    iget-object p0, p0, Les/o9;->n:Ljava/util/concurrent/ConcurrentLinkedQueue;

    return-object p0
.end method

.method private static a(Ljava/lang/String;)V
    .locals 1

    const-string v0, "mpw"

    .line 59
    invoke-static {v0, p0}, Lcom/esfile/screen/recorder/media/util/k;->a(Ljava/lang/String;Ljava/lang/String;)V

    return-void
.end method

.method private a(ZLandroid/media/MediaCodec$BufferInfo;)V
    .locals 1

    .line 54
    iget-object v0, p0, Les/o9;->q:Les/r9;

    if-eqz v0, :cond_0

    .line 55
    invoke-virtual {v0, p1, p2}, Les/r9;->a(ZLandroid/media/MediaCodec$BufferInfo;)V

    :cond_0
    return-void
.end method

.method private a(ZLandroid/media/MediaFormat;)V
    .locals 1

    .line 56
    iget-object v0, p0, Les/o9;->q:Les/r9;

    if-eqz v0, :cond_1

    if-eqz p1, :cond_0

    .line 57
    invoke-virtual {v0, p2}, Les/r9;->a(Landroid/media/MediaFormat;)V

    goto :goto_0

    .line 58
    :cond_0
    invoke-virtual {v0, p2}, Les/r9;->b(Landroid/media/MediaFormat;)V

    :cond_1
    :goto_0
    return-void
.end method

.method static synthetic a(Les/o9;Les/p9;Ljava/util/List;)Z
    .locals 0

    .line 2
    invoke-direct {p0, p1, p2}, Les/o9;->b(Les/p9;Ljava/util/List;)Z

    move-result p0

    return p0
.end method

.method static synthetic a(Les/o9;Z)Z
    .locals 0

    .line 1
    iput-boolean p1, p0, Les/o9;->m:Z

    return p1
.end method

.method private static b(Ljava/lang/String;)V
    .locals 1

    const-string v0, "mpw"

    .line 19
    invoke-static {v0, p0}, Lcom/esfile/screen/recorder/media/util/k;->c(Ljava/lang/String;Ljava/lang/String;)V

    return-void
.end method

.method private b(Les/p9;Ljava/util/List;)Z
    .locals 9
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Les/p9;",
            "Ljava/util/List<",
            "Lcom/esfile/screen/recorder/media/util/l;",
            ">;)Z"
        }
    .end annotation

    .line 13
    iget-boolean v0, p0, Les/o9;->m:Z

    const/4 v1, 0x0

    if-eqz v0, :cond_0

    return v1

    .line 14
    :cond_0
    invoke-interface {p2}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object p2

    const/4 v0, 0x1

    const/4 v2, 0x1

    :goto_0
    invoke-interface {p2}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-eqz v3, :cond_4

    invoke-interface {p2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Lcom/esfile/screen/recorder/media/util/l;

    .line 15
    invoke-virtual {p1}, Les/p9;->r()Z

    move-result v4

    if-eqz v4, :cond_1

    invoke-virtual {p1}, Les/p9;->f()Z

    move-result v4

    invoke-virtual {p0, v4, v3}, Les/o9;->a(ZLcom/esfile/screen/recorder/media/util/l;)J

    move-result-wide v4

    goto :goto_1

    .line 16
    :cond_1
    invoke-virtual {p1}, Les/p9;->f()Z

    move-result v4

    invoke-virtual {p0, v4, v3}, Les/o9;->b(ZLcom/esfile/screen/recorder/media/util/l;)J

    move-result-wide v4

    :goto_1
    const-wide/16 v6, 0x0

    cmp-long v8, v4, v6

    if-gez v8, :cond_2

    goto :goto_2

    :cond_2
    if-eqz v2, :cond_3

    .line 17
    invoke-virtual {p1, v4, v5}, Les/p9;->b(J)V

    const/4 v2, 0x0

    .line 18
    :cond_3
    invoke-virtual {v3}, Lcom/esfile/screen/recorder/media/util/l;->a()V

    goto :goto_0

    :cond_4
    const/4 v1, 0x1

    :goto_2
    return v1
.end method

.method private d()V
    .locals 5

    .line 1
    iget-wide v0, p0, Les/o9;->f:J

    const-wide/16 v2, 0x42

    add-long/2addr v0, v2

    iput-wide v0, p0, Les/o9;->f:J

    .line 2
    sget-object v0, Landroid/os/Build$VERSION;->RELEASE:Ljava/lang/String;

    .line 3
    iget-object v1, p0, Les/o9;->k:Ljava/util/Map;

    const-string v2, "ro.build.version.release"

    invoke-interface {v1, v2, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 4
    iget-wide v1, p0, Les/o9;->f:J

    invoke-virtual {v0}, Ljava/lang/String;->length()I

    move-result v0

    const/16 v3, 0x18

    add-int/2addr v3, v0

    add-int/lit8 v3, v3, 0x20

    int-to-long v3, v3

    add-long/2addr v1, v3

    iput-wide v1, p0, Les/o9;->f:J

    .line 5
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, ""

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    sget v1, Landroid/os/Build$VERSION;->SDK_INT:I

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    .line 6
    iget-object v1, p0, Les/o9;->k:Ljava/util/Map;

    const-string v2, "ro.build.version.sdk"

    invoke-interface {v1, v2, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 7
    iget-wide v1, p0, Les/o9;->f:J

    invoke-virtual {v0}, Ljava/lang/String;->length()I

    move-result v0

    const/16 v3, 0x14

    add-int/2addr v3, v0

    add-int/lit8 v3, v3, 0x20

    int-to-long v3, v3

    add-long/2addr v1, v3

    iput-wide v1, p0, Les/o9;->f:J

    return-void
.end method

.method private e()J
    .locals 8

    .line 1
    iget-boolean v0, p0, Les/o9;->g:Z

    if-eqz v0, :cond_0

    const/4 v0, 0x1

    goto :goto_0

    :cond_0
    const/4 v0, 0x2

    .line 2
    :goto_0
    iget-wide v1, p0, Les/o9;->e:J

    const-wide/16 v3, 0x0

    const-wide/16 v5, 0xc00

    cmp-long v7, v1, v3

    if-eqz v7, :cond_1

    const-wide/16 v3, 0x6

    mul-long v1, v1, v3

    const-wide/16 v3, 0x3e8

    .line 3
    div-long/2addr v1, v3

    goto :goto_1

    :cond_1
    move-wide v1, v5

    :goto_1
    cmp-long v3, v1, v5

    if-gez v3, :cond_2

    goto :goto_2

    :cond_2
    move-wide v5, v1

    :goto_2
    const-wide/32 v1, 0x62e08

    cmp-long v3, v5, v1

    if-lez v3, :cond_3

    move-wide v5, v1

    .line 4
    :cond_3
    iget-wide v1, p0, Les/o9;->f:J

    add-long/2addr v5, v1

    .line 5
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "limits: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-wide v2, p0, Les/o9;->e:J

    invoke-virtual {v1, v2, v3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    const-string v2, " bytes,  and the estimated moov size "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, v5, v6}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    const-string v2, " bytes"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Les/o9;->b(Ljava/lang/String;)V

    int-to-long v0, v0

    mul-long v0, v0, v5

    return-wide v0
.end method

.method private f()V
    .locals 1

    .line 1
    iget-object v0, p0, Les/o9;->q:Les/r9;

    if-eqz v0, :cond_0

    .line 2
    invoke-virtual {v0}, Les/r9;->a()V

    const/4 v0, 0x0

    .line 3
    iput-object v0, p0, Les/o9;->q:Les/r9;

    :cond_0
    return-void
.end method


# virtual methods
.method public a(ILjava/nio/ByteBuffer;Landroid/media/MediaCodec$BufferInfo;)I
    .locals 2
    .param p2    # Ljava/nio/ByteBuffer;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param
    .param p3    # Landroid/media/MediaCodec$BufferInfo;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Exception;
        }
    .end annotation

    .line 27
    iget-boolean v0, p0, Les/o9;->b:Z

    if-eqz v0, :cond_3

    .line 28
    iget-object v0, p0, Les/o9;->a:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    if-ge p1, v0, :cond_2

    .line 29
    iget-object v0, p0, Les/o9;->a:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Les/p9;

    iget-wide v0, p3, Landroid/media/MediaCodec$BufferInfo;->presentationTimeUs:J

    invoke-virtual {p1, p2, p3, v0, v1}, Les/p9;->a(Ljava/nio/ByteBuffer;Landroid/media/MediaCodec$BufferInfo;J)I

    move-result p1

    const/4 p2, -0x1

    if-gt p1, p2, :cond_1

    const/4 p2, -0x2

    if-ne p1, p2, :cond_0

    .line 30
    new-instance p1, Lcom/esfile/screen/recorder/media/util/ExceptionUtil$FileTooLargeException;

    const-string p2, "The file is too large!"

    invoke-direct {p1, p2}, Lcom/esfile/screen/recorder/media/util/ExceptionUtil$FileTooLargeException;-><init>(Ljava/lang/String;)V

    throw p1

    .line 31
    :cond_0
    new-instance p2, Ljava/io/IOException;

    new-instance p3, Ljava/lang/StringBuilder;

    invoke-direct {p3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v0, "Write file error! <"

    invoke-virtual {p3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p3, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string p1, ">"

    invoke-virtual {p3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-direct {p2, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw p2

    :cond_1
    return p1

    .line 32
    :cond_2
    new-instance p2, Ljava/lang/IllegalStateException;

    new-instance p3, Ljava/lang/StringBuilder;

    invoke-direct {p3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v0, "WriteSampleData() get an invalid index "

    invoke-virtual {p3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p3, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    invoke-virtual {p3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-direct {p2, p1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw p2

    .line 33
    :cond_3
    new-instance p1, Ljava/lang/IllegalStateException;

    const-string p2, "WriteSampleData() is called in invalid state"

    invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw p1
.end method

.method public a(Landroid/media/MediaFormat;)I
    .locals 4
    .param p1    # Landroid/media/MediaFormat;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    .line 11
    iget-boolean v0, p0, Les/o9;->b:Z

    const/4 v1, -0x1

    if-eqz v0, :cond_0

    const-string p1, "Attempt to add source AFTER recording is started"

    .line 12
    invoke-static {p1}, Les/o9;->a(Ljava/lang/String;)V

    return v1

    .line 13
    :cond_0
    iget-object v0, p0, Les/o9;->a:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    const/4 v2, 0x2

    if-lt v0, v2, :cond_1

    .line 14
    new-instance p1, Ljava/lang/StringBuilder;

    invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v0, "Too many tracks ("

    invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-object v0, p0, Les/o9;->a:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string v0, ") to add"

    invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-static {p1}, Les/o9;->a(Ljava/lang/String;)V

    return v1

    :cond_1
    const-string v0, "mime"

    .line 15
    invoke-virtual {p1, v0}, Landroid/media/MediaFormat;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    const-string v2, "audio/"

    .line 16
    invoke-virtual {v0, v2}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v2

    const-string v3, "video/"

    .line 17
    invoke-virtual {v0, v3}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v3

    if-nez v2, :cond_2

    if-nez v3, :cond_2

    .line 18
    new-instance p1, Ljava/lang/StringBuilder;

    invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Track ("

    invoke-virtual {p1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v0, ") other than video or audio is not supported"

    invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-static {p1}, Les/o9;->a(Ljava/lang/String;)V

    return v1

    .line 19
    :cond_2
    iget-object v0, p0, Les/o9;->a:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :cond_3
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-eqz v3, :cond_5

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Les/p9;

    .line 20
    invoke-virtual {v3}, Les/p9;->f()Z

    move-result v3

    if-ne v3, v2, :cond_3

    .line 21
    new-instance p1, Ljava/lang/StringBuilder;

    invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V

    if-eqz v2, :cond_4

    const-string v0, "Audio"

    goto :goto_0

    :cond_4
    const-string v0, "Video"

    :goto_0
    invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v0, " track already exists"

    invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-static {p1}, Les/o9;->a(Ljava/lang/String;)V

    return v1

    .line 22
    :cond_5
    invoke-direct {p0, v2, p1}, Les/o9;->a(ZLandroid/media/MediaFormat;)V

    .line 23
    iget-object v0, p0, Les/o9;->a:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    .line 24
    new-instance v1, Les/p9;

    add-int/lit8 v2, v0, 0x1

    invoke-direct {v1, p0, p1, v2}, Les/p9;-><init>(Les/o9;Landroid/media/MediaFormat;I)V

    const/16 p1, 0xa

    .line 25
    invoke-virtual {v1, p1}, Les/p9;->a(I)V

    .line 26
    iget-object p1, p0, Les/o9;->a:Ljava/util/List;

    invoke-interface {p1, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    return v0
.end method

.method a(ZLcom/esfile/screen/recorder/media/util/l;)J
    .locals 5

    .line 36
    :try_start_0
    iget-object v0, p0, Les/o9;->i:Les/n9;

    invoke-virtual {v0}, Ljava/io/RandomAccessFile;->getFilePointer()J

    move-result-wide v0

    .line 37
    iget-object v2, p0, Les/o9;->i:Les/n9;

    iget-object v3, p2, Lcom/esfile/screen/recorder/media/util/l;->b:Ljava/nio/ByteBuffer;

    invoke-virtual {v2, v3}, Les/n9;->a(Ljava/nio/ByteBuffer;)J

    move-result-wide v2

    .line 38
    iget-object v4, p2, Lcom/esfile/screen/recorder/media/util/l;->f:Landroid/media/MediaCodec$BufferInfo;

    long-to-int v3, v2

    iput v3, v4, Landroid/media/MediaCodec$BufferInfo;->size:I

    .line 39
    iget-object p2, p2, Lcom/esfile/screen/recorder/media/util/l;->f:Landroid/media/MediaCodec$BufferInfo;

    invoke-direct {p0, p1, p2}, Les/o9;->a(ZLandroid/media/MediaCodec$BufferInfo;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    return-wide v0

    :catch_0
    move-exception p1

    .line 40
    invoke-virtual {p1}, Ljava/io/IOException;->printStackTrace()V

    const-wide/16 p1, -0x1

    return-wide p1
.end method

.method public a(I)V
    .locals 1

    .line 4
    iget-boolean v0, p0, Les/o9;->b:Z

    if-eqz v0, :cond_0

    const-string p1, "Attempt to set rotation AFTER recording is started"

    .line 5
    invoke-static {p1}, Les/o9;->a(Ljava/lang/String;)V

    return-void

    .line 6
    :cond_0
    iget-object v0, p0, Les/o9;->i:Les/n9;

    invoke-virtual {v0, p1}, Les/n9;->a(I)V

    return-void
.end method

.method public a(J)V
    .locals 3

    .line 7
    iget-boolean v0, p0, Les/o9;->b:Z

    if-eqz v0, :cond_0

    const-string p1, "Attempt to set max file size AFTER recording is started"

    .line 8
    invoke-static {p1}, Les/o9;->a(Ljava/lang/String;)V

    return-void

    .line 9
    :cond_0
    iput-wide p1, p0, Les/o9;->e:J

    const-wide v0, 0xffffffffL

    cmp-long v2, p1, v0

    if-lez v2, :cond_1

    const/4 p1, 0x0

    .line 10
    iput-boolean p1, p0, Les/o9;->g:Z

    :cond_1
    return-void
.end method

.method public a(Z)V
    .locals 1

    .line 34
    invoke-direct {p0}, Les/o9;->f()V

    if-eqz p1, :cond_0

    .line 35
    new-instance p1, Les/r9;

    iget-object v0, p0, Les/o9;->l:Ljava/lang/String;

    invoke-direct {p1, v0}, Les/r9;-><init>(Ljava/lang/String;)V

    iput-object p1, p0, Les/o9;->q:Les/r9;

    :cond_0
    return-void
.end method

.method a()Z
    .locals 9

    .line 47
    iget-wide v0, p0, Les/o9;->e:J

    const/4 v2, 0x0

    const-wide/16 v3, 0x0

    cmp-long v5, v0, v3

    if-gtz v5, :cond_0

    return v2

    .line 48
    :cond_0
    iget-wide v0, p0, Les/o9;->d:J

    .line 49
    iget-object v3, p0, Les/o9;->a:Ljava/util/List;

    invoke-interface {v3}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v3

    :goto_0
    invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z

    move-result v4

    if-eqz v4, :cond_1

    invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Les/p9;

    .line 50
    invoke-virtual {v4}, Les/p9;->q()J

    move-result-wide v4

    add-long/2addr v0, v4

    goto :goto_0

    .line 51
    :cond_1
    iget-boolean v3, p0, Les/o9;->j:Z

    const/4 v4, 0x1

    if-nez v3, :cond_3

    const-wide/16 v5, 0x400

    add-long/2addr v0, v5

    .line 52
    iget-wide v5, p0, Les/o9;->e:J

    cmp-long v3, v0, v5

    if-ltz v3, :cond_2

    const/4 v2, 0x1

    :cond_2
    return v2

    :cond_3
    const-wide/16 v5, 0x5f

    .line 53
    iget-wide v7, p0, Les/o9;->e:J

    mul-long v7, v7, v5

    const-wide/16 v5, 0x64

    div-long/2addr v7, v5

    cmp-long v3, v0, v7

    if-ltz v3, :cond_4

    const/4 v2, 0x1

    :cond_4
    return v2
.end method

.method a(Les/p9;Ljava/util/List;)Z
    .locals 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Les/p9;",
            "Ljava/util/List<",
            "Lcom/esfile/screen/recorder/media/util/l;",
            ">;)Z"
        }
    .end annotation

    .line 41
    iget-boolean v0, p0, Les/o9;->m:Z

    const/4 v1, 0x0

    if-eqz v0, :cond_0

    return v1

    .line 42
    :cond_0
    iget-object v0, p0, Les/o9;->n:Ljava/util/concurrent/ConcurrentLinkedQueue;

    invoke-virtual {v0}, Ljava/util/concurrent/ConcurrentLinkedQueue;->poll()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/util/List;

    if-nez v0, :cond_1

    .line 43
    new-instance v0, Ljava/util/ArrayList;

    invoke-interface {p2}, Ljava/util/List;->size()I

    move-result v2

    invoke-direct {v0, v2}, Ljava/util/ArrayList;-><init>(I)V

    .line 44
    :cond_1
    invoke-interface {v0}, Ljava/util/List;->clear()V

    .line 45
    invoke-interface {v0, p2}, Ljava/util/List;->addAll(Ljava/util/Collection;)Z

    .line 46
    iget-object p2, p0, Les/o9;->p:Les/o9$b;

    invoke-static {p1, v0}, Landroid/util/Pair;->create(Ljava/lang/Object;Ljava/lang/Object;)Landroid/util/Pair;

    move-result-object p1

    invoke-virtual {p2, v1, p1}, Landroid/os/Handler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message;

    move-result-object p1

    invoke-virtual {p1}, Landroid/os/Message;->sendToTarget()V

    const/4 p1, 0x1

    return p1
.end method

.method b()I
    .locals 1

    .line 4
    iget-object v0, p0, Les/o9;->a:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    return v0
.end method

.method b(ZLcom/esfile/screen/recorder/media/util/l;)J
    .locals 5

    .line 9
    :try_start_0
    iget-object v0, p0, Les/o9;->i:Les/n9;

    invoke-virtual {v0}, Ljava/io/RandomAccessFile;->getFilePointer()J

    move-result-wide v0

    .line 10
    iget-object v2, p0, Les/o9;->i:Les/n9;

    iget-object v3, p2, Lcom/esfile/screen/recorder/media/util/l;->b:Ljava/nio/ByteBuffer;

    invoke-virtual {v2, v3}, Les/n9;->b(Ljava/nio/ByteBuffer;)J

    move-result-wide v2

    .line 11
    iget-object v4, p2, Lcom/esfile/screen/recorder/media/util/l;->f:Landroid/media/MediaCodec$BufferInfo;

    long-to-int v3, v2

    iput v3, v4, Landroid/media/MediaCodec$BufferInfo;->size:I

    .line 12
    iget-object p2, p2, Lcom/esfile/screen/recorder/media/util/l;->f:Landroid/media/MediaCodec$BufferInfo;

    invoke-direct {p0, p1, p2}, Les/o9;->a(ZLandroid/media/MediaCodec$BufferInfo;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    return-wide v0

    :catch_0
    const-wide/16 p1, -0x1

    return-wide p1
.end method

.method b(J)V
    .locals 5

    .line 5
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "setStartTimestampUs: "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0, p1, p2}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Les/o9;->b(Ljava/lang/String;)V

    .line 6
    iget-wide v0, p0, Les/o9;->h:J

    const-wide/16 v2, 0x0

    cmp-long v4, v0, v2

    if-ltz v4, :cond_0

    cmp-long v2, v0, p1

    if-lez v2, :cond_1

    .line 7
    :cond_0
    iput-wide p1, p0, Les/o9;->h:J

    .line 8
    new-instance p1, Ljava/lang/StringBuilder;

    invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V

    const-string p2, "Earliest track starting time: "

    invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-wide v0, p0, Les/o9;->h:J

    invoke-virtual {p1, v0, v1}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-static {p1}, Les/o9;->b(Ljava/lang/String;)V

    :cond_1
    return-void
.end method

.method public b(Z)V
    .locals 1

    .line 1
    iget-boolean v0, p0, Les/o9;->b:Z

    if-eqz v0, :cond_0

    const-string p1, "Attempt to set use 32-bit offset AFTER recording is started"

    .line 2
    invoke-static {p1}, Les/o9;->a(Ljava/lang/String;)V

    return-void

    :cond_0
    xor-int/lit8 p1, p1, 0x1

    .line 3
    iput-boolean p1, p0, Les/o9;->g:Z

    return-void
.end method

.method c()Z
    .locals 1

    .line 1
    iget-boolean v0, p0, Les/o9;->g:Z

    return v0
.end method

.method public release()V
    .locals 1

    .line 1
    iget-boolean v0, p0, Les/o9;->c:Z

    if-nez v0, :cond_0

    return-void

    .line 2
    :cond_0
    iget-boolean v0, p0, Les/o9;->b:Z

    if-eqz v0, :cond_1

    .line 3
    invoke-virtual {p0}, Les/o9;->stop()Z

    .line 4
    :cond_1
    :try_start_0
    iget-object v0, p0, Les/o9;->i:Les/n9;

    if-eqz v0, :cond_2

    .line 5
    iget-object v0, p0, Les/o9;->i:Les/n9;

    invoke-virtual {v0}, Ljava/io/RandomAccessFile;->close()V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    nop

    .line 6
    :cond_2
    :goto_0
    iget-object v0, p0, Les/o9;->o:Landroid/os/HandlerThread;

    if-eqz v0, :cond_3

    .line 7
    invoke-virtual {v0}, Landroid/os/HandlerThread;->quit()Z

    .line 8
    :cond_3
    iget-object v0, p0, Les/o9;->a:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->clear()V

    .line 9
    invoke-direct {p0}, Les/o9;->f()V

    const/4 v0, 0x0

    .line 10
    iput-boolean v0, p0, Les/o9;->c:Z

    .line 11
    iput-boolean v0, p0, Les/o9;->b:Z

    return-void
.end method

.method public start()Z
    .locals 8

    .line 1
    iget-boolean v0, p0, Les/o9;->c:Z

    const/4 v1, 0x0

    if-nez v0, :cond_0

    return v1

    .line 2
    :cond_0
    iget-boolean v0, p0, Les/o9;->g:Z

    const-wide/16 v2, 0x0

    if-eqz v0, :cond_2

    .line 3
    iget-wide v4, p0, Les/o9;->e:J

    const-wide v6, 0xffffffffL

    cmp-long v0, v4, v2

    if-nez v0, :cond_1

    .line 4
    iput-wide v6, p0, Les/o9;->e:J

    .line 5
    :cond_1
    iget-wide v4, p0, Les/o9;->e:J

    cmp-long v0, v4, v6

    if-lez v0, :cond_2

    .line 6
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "32-bit file size limit ("

    invoke-virtual {v0, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-wide v4, p0, Les/o9;->e:J

    invoke-virtual {v0, v4, v5}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    const-string v4, " bytes) too big. It is changed to "

    invoke-virtual {v0, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0, v6, v7}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    const-string v4, " bytes"

    invoke-virtual {v0, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Les/o9;->b(Ljava/lang/String;)V

    .line 7
    iput-wide v6, p0, Les/o9;->e:J

    :cond_2
    const-wide/16 v4, -0x1

    .line 8
    iput-wide v4, p0, Les/o9;->h:J

    .line 9
    iget-boolean v0, p0, Les/o9;->b:Z

    const/4 v4, 0x1

    if-eqz v0, :cond_3

    return v4

    .line 10
    :cond_3
    iget-object v0, p0, Les/o9;->a:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->isEmpty()Z

    move-result v0

    if-eqz v0, :cond_4

    const-string v0, "There is not tracks to start."

    .line 11
    invoke-static {v0}, Les/o9;->a(Ljava/lang/String;)V

    return v1

    .line 12
    :cond_4
    :try_start_0
    iget-object v0, p0, Les/o9;->i:Les/n9;

    invoke-virtual {v0}, Les/n9;->d()V

    .line 13
    iget-object v0, p0, Les/o9;->i:Les/n9;

    iget-boolean v5, p0, Les/o9;->g:Z

    invoke-virtual {v0, v5}, Les/n9;->a(Z)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 14
    iget-wide v5, p0, Les/o9;->d:J

    cmp-long v0, v5, v2

    if-nez v0, :cond_5

    .line 15
    invoke-direct {p0}, Les/o9;->e()J

    move-result-wide v2

    iput-wide v2, p0, Les/o9;->d:J

    .line 16
    :cond_5
    iget-object v0, p0, Les/o9;->a:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :goto_0
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-eqz v2, :cond_6

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Les/p9;

    .line 17
    invoke-virtual {v2}, Les/p9;->s()V

    goto :goto_0

    .line 18
    :cond_6
    iget-object v0, p0, Les/o9;->o:Landroid/os/HandlerThread;

    if-eqz v0, :cond_7

    .line 19
    invoke-virtual {v0}, Landroid/os/HandlerThread;->quit()Z

    .line 20
    :cond_7
    new-instance v0, Landroid/os/HandlerThread;

    const-string v2, "write-chunk-th"

    invoke-direct {v0, v2}, Landroid/os/HandlerThread;-><init>(Ljava/lang/String;)V

    iput-object v0, p0, Les/o9;->o:Landroid/os/HandlerThread;

    .line 21
    invoke-virtual {v0}, Landroid/os/HandlerThread;->start()V

    .line 22
    new-instance v0, Les/o9$b;

    iget-object v2, p0, Les/o9;->o:Landroid/os/HandlerThread;

    invoke-virtual {v2}, Landroid/os/HandlerThread;->getLooper()Landroid/os/Looper;

    move-result-object v2

    const/4 v3, 0x0

    invoke-direct {v0, p0, v2, v3}, Les/o9$b;-><init>(Les/o9;Landroid/os/Looper;Les/o9$a;)V

    iput-object v0, p0, Les/o9;->p:Les/o9$b;

    .line 23
    iput-boolean v4, p0, Les/o9;->b:Z

    :catch_0
    return v1
.end method

.method public stop()Z
    .locals 5

    .line 1
    iget-boolean v0, p0, Les/o9;->c:Z

    const/4 v1, 0x1

    if-nez v0, :cond_0

    return v1

    .line 2
    :cond_0
    iget-boolean v0, p0, Les/o9;->b:Z

    if-nez v0, :cond_1

    .line 3
    invoke-virtual {p0}, Les/o9;->release()V

    return v1

    :cond_1
    const/4 v0, 0x0

    .line 4
    iput-boolean v0, p0, Les/o9;->b:Z

    .line 5
    iget-object v2, p0, Les/o9;->a:Ljava/util/List;

    invoke-interface {v2}, Ljava/util/List;->isEmpty()Z

    move-result v2

    .line 6
    iget-object v3, p0, Les/o9;->a:Ljava/util/List;

    invoke-interface {v3}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v3

    :goto_0
    invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z

    move-result v4

    if-eqz v4, :cond_4

    invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Les/p9;

    .line 7
    invoke-virtual {v4}, Les/p9;->t()V

    if-nez v2, :cond_3

    .line 8
    invoke-virtual {v4}, Les/p9;->b()Ljava/util/List;

    move-result-object v2

    invoke-interface {v2}, Ljava/util/List;->isEmpty()Z

    move-result v2

    if-eqz v2, :cond_2

    goto :goto_1

    :cond_2
    const/4 v2, 0x0

    goto :goto_0

    :cond_3
    :goto_1
    const/4 v2, 0x1

    goto :goto_0

    :cond_4
    if-eqz v2, :cond_5

    .line 9
    invoke-virtual {p0}, Les/o9;->release()V

    return v1

    .line 10
    :cond_5
    iget-object v0, p0, Les/o9;->o:Landroid/os/HandlerThread;

    if-eqz v0, :cond_6

    .line 11
    invoke-virtual {v0}, Landroid/os/HandlerThread;->quitSafely()Z

    .line 12
    :try_start_0
    iget-object v0, p0, Les/o9;->o:Landroid/os/HandlerThread;

    invoke-virtual {v0}, Landroid/os/HandlerThread;->join()V
    :try_end_0
    .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0

    .line 13
    :catch_0
    :cond_6
    :try_start_1
    iget-object v0, p0, Les/o9;->i:Les/n9;

    invoke-virtual {v0}, Les/n9;->b()V

    .line 14
    iget-object v0, p0, Les/o9;->i:Les/n9;

    iget-object v2, p0, Les/o9;->a:Ljava/util/List;

    iget-object v3, p0, Les/o9;->k:Ljava/util/Map;

    invoke-virtual {v0, v2, v3}, Les/n9;->a(Ljava/util/List;Ljava/util/Map;)V
    :try_end_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_2

    :catchall_0
    move-exception v0

    .line 15
    invoke-virtual {p0}, Les/o9;->release()V

    .line 16
    throw v0

    .line 17
    :catch_1
    :goto_2
    invoke-virtual {p0}, Les/o9;->release()V

    return v1
.end method
